<?php

use yii\db\Schema;
use yii\db\Migration;

class m160307_080846_add_condition_type_for_mv extends Migration
{
    public function up()
    {
        $this->addColumn('{{%condition_type}}', 'is_for_mobile_video', "int(1) NOT NULL DEFAULT '0' COMMENT '是否为 mobile 定向内容' after is_for_mobile");
        $sql = <<<FINE
        update {{%condition_type}} set is_for_mobile_video = is_for_mobile;
FINE;
        $this->execute($sql);
    }

    public function down()
    {
        return $this->dropColumn('{{%condition_type}}', 'is_for_mobile_video');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
